export interface RouteConfig {
  path: string;
  name?: string;
  redirect?: string;
  component?: () => Promise<any>; // 使用any类型避免import()语法错误
  children?: RouteConfig[];
  meta?: {
    title?: string;
    icon?: string | any;
  };
}

// 路由配置
export const routes: RouteConfig[] = [
  {
    path: "/login",
    name: "login",
    component: () => import("../views/login/index.vue"),
    meta: {
      title: "登录",
    },
  },
  {
    path: "/",
    name: "layout",
    component: () => import("@/layouts/index.vue"),
    redirect: "/home",
    children: [
      {
        path: "/",
        redirect: "/home",
      },
      {
        path: "/home",
        name: "home",
        component: () => import("../views/Home.vue"),
        meta: {
          title: "订单首页",
          icon: "House",
        },
      },
      {
        path: "/list",
        name: "list",
        component: () => import("../views/OrderList.vue"),
        meta: {
          title: "订单列表",
          icon: "List",
        },
      },
      {
        path: "/create",
        name: "create",
        component: () => import("../views/CreateOrder.vue"),
        meta: {
          title: "创建订单",
          icon: "Goods",
        },
      },
      {
        path: "/detail/:id?",
        name: "detail",
        component: () => import("../views/OrderDetail.vue"),
        meta: {
          title: "订单详情",
          icon: "Goods",
        },
      },
    ],
  },
];
